import unittest
import requests
import time
from common import public_login

base_header = {'cookie': public_login.gl_cookie()}


def base_req(base_url, base_data):
    r = requests.post(url=base_url, data=base_data, headers=base_header)
    result = r.json()
    res = str(result)

    aver_1 = str('"status":"01"')
    aver_2 = str("'result': '成功'")

    if len(res) > 50:
        """
        assertIn 判断是否包含, assertEqual 判断是否一致
        """
        if aver_1 in res:
            print("断言成功 ！")
        else:
            print("断言失败 ！")
    else:
        if aver_2 in res:
            print("断言成功 ！")
        else:
            print("断言失败 ！")

    return result


if __name__ == '__main__':
    base_req(base_url='', base_data='')
